package org.wmq.skyserver.controller.user;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.wmq.skycommon.WebSocket.WebSocketServer;
import org.wmq.skycommon.pojo.DTO.OrderSubmitDTO;
import org.wmq.skycommon.pojo.VO.OrderSubmitVO;
import org.wmq.skycommon.pojo.entity.Result;
import org.wmq.skyserver.service.OrderService;

import java.util.HashMap;
import java.util.Map;

@RestController("userOrderController")
@RequestMapping("/user/order")
@Api(tags = "用户端订单相关接口")
@RequiredArgsConstructor
public class OrderController {
    private final OrderService orderService;
    private final WebSocketServer webSocketServer;


    @PostMapping("/submit")
    public Result submit(@RequestBody OrderSubmitDTO orderSubmitDTO) {
        OrderSubmitVO orderSubmitVO = this.orderService.submitOrder(orderSubmitDTO);
        return Result.success(orderSubmitVO);
    }

    @GetMapping("/reminder/{id}")
    @ApiOperation("客户催单")
    public Result reminder(@PathVariable(name = "id") Integer orderId) {
        this.orderService.reminder(orderId);
        return Result.success();
    }
}
